package com.example.droolstest.controller;

import com.example.droolstest.entity.BusinessRuleTemp;
import com.example.droolstest.service.BusinessRuleTempService;
import com.example.droolstest.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/businessRuleTemp")
public class BusinessRuleTempController {

    @Autowired
    private BusinessRuleTempService businessTypeService;

    /**
     * 新增业务类型
     *
     * @param businessType
     * @return
     */
    @PostMapping("")
    public AjaxResult saveBusinessType(@RequestBody BusinessRuleTemp businessType) {
        businessTypeService.add(businessType);
        return AjaxResult.success();
    }


    @GetMapping("")
    public AjaxResult list(){
        return AjaxResult.success(businessTypeService.list());
    }

    @PostMapping("/del")
    public AjaxResult del(Integer id){
        businessTypeService.removeById(id);
        return AjaxResult.success();
    }
}
